package main

import (
	"encoding/json"
	"fmt"
)

type Student struct {
	Name   string            `json:"name,omitempty"`
	Age    int               `json:"age,omitempty"`
	Scores [5]float64        `json:"scores,omitempty"`
	Ptr    *int              `json:"ptr,omitempty"`
	Slice  []int             `json:"slice,omitempty"`
	Map1   map[string]string `json:"map_1,omitempty"`
}

func main() {
	//定义结构体
	num := 100
	var stu2 = Student{"tom", 12, [5]float64{1, 2, 3, 4}, &num, make([]int, 10), make(map[string]string)}

	marshal, err := json.Marshal(stu2)
	if err != nil {
		fmt.Println("error")
	}
	s := string(marshal)
	fmt.Println(s)
}
